<?php

namespace app\store\service;

use app\store\model\Banner;
use think\facade\Db;

class BannerService
{

    public static function getBannerList()
    {   
        $store_id = session('store_id');

        $model = new Banner();
        $banners = $model->where('store_id',$store_id)->order('sort','asc')->select();
        
        return  $banners;
        
    }

    public static function saveBanner($data)
    {
       $model = new Banner();
       $res =  $model->saveAll($data);

       return $res;
    }

    public static function deleteBanner($id)
    {
        $res =  Db::name('banner')->where('id',$id)->delete();

        return $res;
    }
    
}